package com.ruoyi.business.domain.product;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;
import java.util.List;

/**
 * 规格分类模板表实体类
 * 对应数据库表：tb_product_spec_templates
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "tb_product_spec_templates" , autoResultMap = true)
@ApiModel(value = "TbProductSpecTemplates", description = "规格分类模板表实体类")
public class TbProductSpecTemplates extends BaseEntity {

    /**
     * 规格模板表主键id
     */
    @ApiModelProperty(value = "规格模板表主键id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 分类id
     */
    @ApiModelProperty(value = "分类id")
    private Long categoryId;

    /**
     * 规格名称
     */
    @ApiModelProperty(value = "规格名称")
    private String name;

    /**
     * 规格值
     */
    @ApiModelProperty(value = "规格值")
    @TableField(value = "spec_values", typeHandler = JacksonTypeHandler.class)
    private List<SpecValueVO> specValues;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间", readOnly = true)
    private Date createTime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新时间", readOnly = true)
    private Date updateTime;

    /**
     * 创建人
     */
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人", readOnly = true)
    private String createBy;

    /**
     * 更新人
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新人", readOnly = true)
    private String updateBy;


    @Data
    public static class SpecValueVO {
        private String value; // 规格值（如“黑色”“128GB”）
        private String image; // 规格值对应的图片（如颜色的色卡图片，可选）
    }
}
